﻿/// <reference path="TreeNodeType.js" />
/// <reference path="HyperLinkNode.js" />
/// <reference path="SelectionNode.js" />
/// <reference path="TemplateNode.js" />
/// <reference path="ExpansionNode.js" />



var $TreeNodeCollection = TA.Turbo.Common.TreeNodeCollection = function TreeNodeCollection()
{
	this.JsonCompatibleCollection();
}
$TreeNodeCollection.Inherit(JsonCompatibleCollection);
if (_____a)
{
	$TreeNodeCollection.prototype = new JsonCompatibleCollection();
}

$TreeNodeCollection.prototype.CreateOneItem = function CreateOneItem(value)
{
	switch (value["Y"])
	{
		case TreeNodeType.HyperLink:
			return new $HyperLinkNode();
		case TreeNodeType.Selection:
			return new $SelectionNode();
		case TreeNodeType.Template:
			return new $TemplateNode();
		case TreeNodeType.Expansion:
			return new $ExpansionNode();
		case TreeNodeType.CheckBox:
			return new $CheckBoxNode();
	}
}
$TreeNodeCollection.prototype.FindById = function FindById(uniqueId)
{
	for (var i = 0; i < this.length; ++i)
	{
		var node = this[i];

		if (node.UniqueId == uniqueId) return node;
		var t = node.get_Children().FindById(uniqueId);
		if (t != null)
			return t;
	}
	return null;
}